package com.hanzidong.cms.entity;

import java.io.Serializable;
import java.util.Date;

import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 用户表
 * @author Administrator
 * @version
 */
public class User implements Serializable{
	
	private Integer id;             //
	
	@NotBlank(message = "用户名不能为空")
	@Length(min = 2,max=20,message = "用户名长度需要在2位-20位之间")
	private String username;        //用户名
	@NotBlank(message = "密码不能为空")
	@Length(min = 6,message = "密码不得小于6位")
	private String password;        //密码
	@NotBlank(message = "昵称不能为空")
	private String nickname;        //用户昵称
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date birthday;          //生日
	private Integer gender;         //性别
	private Integer locked;         //0:正常,1:禁用
	private Date created;           //创建日期
	private Date updated;           //修改日期
	private String role;            //0:普通用户,1:管理员
	private String url;             //个人博客网址
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getNickname() {
		return nickname;
	}
	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public Integer getGender() {
		return gender;
	}
	public void setGender(Integer gender) {
		this.gender = gender;
	}
	public Integer getLocked() {
		return locked;
	}
	public void setLocked(Integer locked) {
		this.locked = locked;
	}
	public Date getCreated() {
		return created;
	}
	public void setCreated(Date created) {
		this.created = created;
	}
	public Date getUpdated() {
		return updated;
	}
	public void setUpdated(Date updated) {
		this.updated = updated;
	}
	public String getRole() {
		return role;
	}
	public void setRole(String role) {
		this.role = role;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public User(Integer id, String username, String password, String nickname, Date birthday, Integer gender,
			Integer locked, Date created, Date updated, String role, String url) {
		super();
		this.id = id;
		this.username = username;
		this.password = password;
		this.nickname = nickname;
		this.birthday = birthday;
		this.gender = gender;
		this.locked = locked;
		this.created = created;
		this.updated = updated;
		this.role = role;
		this.url = url;
	}
	public User() {
		super();
	}
	@Override
	public String toString() {
		return "User [id=" + id + ", username=" + username + ", password=" + password + ", nickname=" + nickname
				+ ", birthday=" + birthday + ", gender=" + gender + ", locked=" + locked + ", created=" + created
				+ ", updated=" + updated + ", role=" + role + ", url=" + url + "]";
	}
	
	

}
